cmake_minimum_required(VERSION 3.16)
project(CPUSchedulerGUI)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Enable automatic MOC, RCC and UIC processing
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

# Find Qt packages
find_package(Qt6 REQUIRED COMPONENTS Core Widgets)

# File lists
set(SOURCES
    src/main.cpp
    src/mainwindow.cpp
    src/settingsdialog.cpp
    src/configmanager.cpp
)

set(HEADERS
    include/mainwindow.h
    include/settingsdialog.h
    include/configmanager.h
)

set(RESOURCES
    resources/resources.qrc
)

# Add the executable
add_executable(cpu-scheduler-gui
    ${SOURCES}
    ${HEADERS}
    ${RESOURCES}
)

# Link Qt libraries
target_link_libraries(cpu-scheduler-gui Qt6::Core Qt6::Widgets)

# Include directories
target_include_directories(cpu-scheduler-gui PRIVATE include)

# Copy script files to build directory
configure_file(resources/scripts/cpu-scheduler.conf ${CMAKE_CURRENT_BINARY_DIR}/cpu-scheduler.conf COPYONLY)
configure_file(resources/scripts/cpu_scheduler.sh ${CMAKE_CURRENT_BINARY_DIR}/cpu_scheduler.sh COPYONLY)
configure_file(resources/scripts/install_service.sh ${CMAKE_CURRENT_BINARY_DIR}/install_service.sh COPYONLY)
configure_file(resources/scripts/uninstall_service.sh ${CMAKE_CURRENT_BINARY_DIR}/uninstall_service.sh COPYONLY)
configure_file(resources/scripts/cpu-scheduler.service ${CMAKE_CURRENT_BINARY_DIR}/cpu-scheduler.service COPYONLY)